
import java.util.ArrayList;
import java.util.List;

import javax.swing.AbstractListModel;
import javax.swing.DefaultListModel;


@SuppressWarnings("serial")
public class FigureListModel extends DefaultListModel {
	public List<ItemBoxed> list;
	ItemBoxed[] ibc;
	
	FigureListModel(ItemBoxed[] ib){
		this.ibc = ib;
		newListFromItemBox(ibc);
	}
	
	public List<ItemBoxed> newListFromItemBox(ItemBoxed[] ib){
		list  = new ArrayList<ItemBoxed>();
		for(int i=0; i < ib.length; i++) list.add(ib[i]);
		return list;
	}
	
	
	public DefaultListModel addItem(){
		ItemBoxed ib = new ItemBoxed("000", "New Nendo");
		this.list.add(ib);
		this.addElement(ib);
		new ItemCard(ib);
		return this;
	}
	
	public DefaultListModel removeSelectedItem(int index){
		System.out.println("Curr list size : "+this.list+" Current listmodelsize : "+this);
		//
		//this.list.remove(index);
		return this;
	}
	
	@Override
	public Object getElementAt(int arg0) {
		return this.list.get(arg0);
	}

	@Override
	public int getSize() {
		return this.list.size();
	}

}
